import request  from "@/utils/request";




const  api_name = "/admin/system/sysUser";

export function getRoleIdsByUserId(userId) {
  return request({
    url: '/admin/system/sysUserRole/getRoleIdsByUserId',
    method: 'get',
    params: {userId: userId},
  })
}
export function assignRoleToUser(data) {
  return request({
    url:`/admin/system/sysUserRole/assignRoleToUser`,
    method: "POST",
    data,
  })
}
export function deleteSysRoleSysUser(sysUser) {
  return request({
    url:`${api_name}/deleteSysUser`,
    method:"DELETE",
    data:sysUser
  })
}

export function modifySysUser(sysUser) {
  return request({
    url: `${api_name}/modifySysUser`,
    method: 'PUT',
    data: sysUser,
  })
}

export function addSysUser(sysUser) {
  return request({
    url: `${api_name}/addSysUser`,
    method: "POST",
    data: sysUser
  })
}
export const getUserByPage = (data)=>{
  return request({
    url: `${api_name}/findByPage/${data.pageNum}/${data.pageSize}`,
    method: 'get',
    params: {
      keyword: data.keyword,
      createTimeBegin: data.fromDate[0],
      createTimeEnd: data.fromDate[1],
    },
  })
}
